package com.blog.common.web;

import com.blog.common.vo.JsonResult;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @ClassName:GlobExceptionHandler
 * @Author:wubo
 * @Data:2020/7/28 10:39
 */

@RestControllerAdvice
public class GlobalExceptionHandler {

    private Log logging = LogFactory.getLog(GlobalExceptionHandler.class);

    @ExceptionHandler(RuntimeException.class)
    public JsonResult defaultHandler(RuntimeException e){
        e.printStackTrace();
        return JsonResult.fail(e, e.getMessage());
    }
}
